<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
		<script type="text/javascript" src="{{__PUBLIC__}}/jquery-1.8.2.min.js"></script>
	    <!-- Loading Bootstrap -->
	    <link href="{{__PUBLIC__}}/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="{{__PUBLIC__}}/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
		<link href="{{__PUBLIC__}}/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
		<link href="{{__PUBLIC__}}/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
		<link rel="stylesheet" href="{{__PUBLIC__}}/hdjs/hdjs.css">
		<script type="text/javascript" src="{{__PUBLIC__}}/hdjs/hdjs.min.js"></script>
		<!-- 新 Bootstrap 核心 CSS 文件 -->
		<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	</head>
	<body>
		<table class="table table-hover">
			<tr class="active">
			  <th width="30">uid</th>
			  <th>用户名称</th>
			  <th>姓名</th>
	          <th>上次登录ip</th>
	          <th>上次登录时间</th>
	          <th>职位</th>
	          <th>状态</th>
			  <th width="210">操作</th>
			</tr>
			{{foreach from="$data" key="$k" value="$v"}}
				<tr>
					<td>{{$v['uid']}}</td>
					<td>{{$v['username']}}</td>
					<td>{{$v['nickname']}}</td>
					<td>{{$v['login_ip']}}</td>
					<td>{{date('Y-m-d H:i',$v['login_time'])}}</td>
					<td>{{$v['class']}}</td>
					<td><i {{if value="$v['statu']==0"}}
							class="glyphicon glyphicon-ok"
						{{elseif value="$v['statu']==1"}}
							class="glyphicon glyphicon-remove"
						{{endif}}
					></i></td>
					<td>
						{{if value="$v['statu']==0"}}
							<a href="javascript:;" class="btn btn-sm btn-danger lock" uid="{{$v['uid']}}">锁定</a>
						{{else}}
							<a href="javascript:;" class="btn btn-sm btn-primary unlock" uid="{{$v['uid']}}">解锁</a>
						{{endif}}
						<a href="{{U('editUser',array('uid'=>$v['uid']))}}" class="btn btn-sm btn-warning">编辑</a>
						<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin={{$v['qq']}}&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:{{$v['qq']}}:51" alt="联系{{$v['nickname']}}" title="联系{{$v['nickname']}}"/></a>
					</td>
				</tr>
			{{endforeach}}
		</table>
	 <ul class="pagination">
	    {{$page}}
	 </ul>
	</body>
<script type="text/javascript">
	$('.lock').live('click',function(){
		obj=$(this);
		uid=obj.attr('uid');
		// pobj=obj.parent();
		$.ajax({
			url:'{{U("lockUser")}}',
			type:'post',
			data:{uid:uid},
			dataType:'json',
			success:function(data){
				// alert(data)
				if(data.statu==1){
					hd_alert_test('锁定成功');
					/*pobj.prepend('<a href="javascript:;" uid='+uid+' class="btn btn-sm btn-primary">解锁</a>');
					obj.remove();*/
				}
			}
		})
	})
	$('.unlock').live('click',function(){
		obj=$(this);
		uid=obj.attr('uid');
		$.ajax({
			url:'{{U("unLockUser")}}',
			type:'post',
			data:{uid:uid},
			dataType:'json',
			success:function(data){
				// alert(data)
				if(data.statu==1){
					hd_alert_test('解锁成功');
				}
			}
		})
	})
    //气泡提示信息实例
    function hd_alert_test(msg) {
        hd_alert({
            message: msg,//显示内容
            timeout: 1,//显示时间
            success: function () {//这是回调函数
            	location.reload();
            }
        })
    }
</script>
</html>
